package com.party.web.web.controller.wechat;

import com.alibaba.fastjson.JSONObject;
import com.party.common.paging.Page;
import com.party.web.biz.wechat.WechatMaterialBizService;
import com.party.web.web.dto.AjaxResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by admin on 2017/9/4.
 */
@Controller
@RequestMapping("/wechat/material")
public class WechatMaterialController {

    @Autowired
    private WechatMaterialBizService wechatMaterialBizService;

    //获取永久素材列表
    @ResponseBody
    @RequestMapping("getMaterialList")
    public AjaxResult getMaterialList(String type,Page page){
        AjaxResult ajaxResult = new AjaxResult();
//        MaterialListRequest req = new MaterialListRequest();
//        req.setType(type);
//        req.setOffset((page.getPage() - 1) * 9);
//        req.setCount(9);
//        page.setLimit(9);
//        MaterialListResponse resp = wechatMaterialBizService.batchGetMaterial(req);
//        if(resp == null){
//            ajaxResult.setSuccess(false);
//            ajaxResult.setDescription("获取失败");
//        }else{
//            page.setTotalCount(resp.getTotalCount());
//            ajaxResult.setSuccess(true);
//            ajaxResult.setData(resp);
//            ajaxResult.setPage(page);
//        }
//        return ajaxResult;
        page.setTotalCount(9);
        ajaxResult.setPage(page);
        String news = "{\"item\":[{\"content\":{\"create_time\":1505446811,\"news_item\":[{\"author\":\"\",\"content\":\"<p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">戈壁挑战赛</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><br  /></p><p style=\\\"white-space: normal;\\\"><img data-s=\\\"300,640\\\" data-type=\\\"jpeg\\\" data-src=\\\"http://mmbiz.qpic.cn/mmbiz_jpg/0ha58BRPxbaDtRricLzPo13MDMLo2vzFmfSskPb28GMu51YYkcf1umibMBGbTndpmVT3pUuYibG4t4klp3rl7gD7g/0?wx_fmt=jpeg\\\" data-ratio=\\\"1.7859375\\\" data-w=\\\"1280\\\"  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><br  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">敦煌&nbsp;? 组委会</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">5月11日</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\"><a href=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=99f8e51a85d24c2e85301851a89fa078\\\" target=\\\"_blank\\\" data_ue_src=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=99f8e51a85d24c2e85301851a89fa078\\\">?立即报名?</a></span></p><p><br  /></p>\",\"content_source_url\":\"\",\"digest\":\"戈壁挑战赛敦煌 ? 组委会5月11日?立即报名?\",\"need_open_comment\":0,\"only_fans_can_comment\":0,\"show_cover_pic\":0,\"thumb_media_id\":\"IscUQ9wYWha7tecu3dXpiH8ai62soH8vFkBec_jN-q4\",\"thumb_url\":\"http://mmbiz.qpic.cn/mmbiz_jpg/YeXepVfg851mGPARO3NOVXpIic3xev14AQ6jA7Rft8jKyE6b49GQ0pUye42HmWmvibreZJickdCsjXHYriae0Sdu2Q/0?wx_fmt=jpeg\",\"title\":\"戈壁挑战赛\",\"url\":\"http://mp.weixin.qq.com/s?__biz=MzA4ODkxODQ0OQ==&mid=100000033&idx=1&sn=3b6ad013d58381c6c7bda0e6649aab19&chksm=102391ff275418e93216b56c5c6ce90ef0b8326341a2de492fba340a9292f704b61a9c857479#rd\"}],\"update_time\":1505460526},\"media_id\":\"IscUQ9wYWha7tecu3dXpiNsBXuBlE6fGk-j2Q5Q-W6o\",\"update_time\":1505460526},{\"content\":{\"create_time\":1505446757,\"news_item\":[{\"author\":\"\",\"content\":\"<p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">博览会考察</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><br  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><img data-s=\\\"300,640\\\" data-type=\\\"jpeg\\\" data-src=\\\"http://mmbiz.qpic.cn/mmbiz_jpg/0ha58BRPxbaDtRricLzPo13MDMLo2vzFmq48QZVIs5wYkSjGr36ygs0N8zS7KCicbxl3pEZDAl5TZzsBSYn5RmNw/0?wx_fmt=jpeg\\\" data-ratio=\\\"0.666\\\" data-w=\\\"500\\\"  /></p><p style=\\\"white-space: normal;\\\"><br  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">德国 ? 飞马游学</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">4月28日</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><a href=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=658155dc30f64cae94f11a222d3601f2\\\" target=\\\"_blank\\\" data_ue_src=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=658155dc30f64cae94f11a222d3601f2\\\"><span style=\\\"font-size: 18px;\\\">?立即报名?</span></a></p><p><br  /></p>\",\"content_source_url\":\"\",\"digest\":\"博览会考察德国 ? 飞马游学4月28日?立即报名?\",\"need_open_comment\":0,\"only_fans_can_comment\":0,\"show_cover_pic\":0,\"thumb_media_id\":\"IscUQ9wYWha7tecu3dXpiJfRjw0B1Eo2pQ0hud1eeXg\",\"thumb_url\":\"http://mmbiz.qpic.cn/mmbiz_jpg/YeXepVfg851mGPARO3NOVXpIic3xev14A9dm1ySt7Cdr95vXlPkq5pDZ4td9eYkuh1VDpNBIf7fia33QANkB3AfA/0?wx_fmt=jpeg\",\"title\":\"博览会考察\",\"url\":\"http://mp.weixin.qq.com/s?__biz=MzA4ODkxODQ0OQ==&mid=100000031&idx=1&sn=c42a13017121b6c2004dc529989dae50&chksm=102391c1275418d729335f7ff02d4356f9d121273ca2181bd384371de47a78663c521da6f3c1#rd\"}],\"update_time\":1505446757},\"media_id\":\"IscUQ9wYWha7tecu3dXpiKhx2HNsbZryqhdRj0TgobM\",\"update_time\":1505446757},{\"content\":{\"create_time\":1505446725,\"news_item\":[{\"author\":\"\",\"content\":\"<p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">动漫游学</span><br  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><br  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><img data-s=\\\"300,640\\\" data-type=\\\"jpeg\\\" data-src=\\\"http://mmbiz.qpic.cn/mmbiz_jpg/0ha58BRPxbaDtRricLzPo13MDMLo2vzFmsWQJs8skEia16icqWFJyTYpdSoBibwcNtfQrGSNnFvZlGkjg3jdSQLTPg/0?wx_fmt=jpeg\\\" data-ratio=\\\"1.7751479289940828\\\" data-w=\\\"338\\\"  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><br  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">日本 ? 飞马游学</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">3月20日</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><a href=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=b7106b38905645c29549732afd009747\\\" target=\\\"_blank\\\" data_ue_src=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=b7106b38905645c29549732afd009747\\\"><span style=\\\"font-size: 18px;\\\">?立即报名?</span></a></p><p><br  /></p>\",\"content_source_url\":\"\",\"digest\":\"动漫游学日本 ? 飞马游学3月20日?立即报名?\",\"need_open_comment\":0,\"only_fans_can_comment\":0,\"show_cover_pic\":0,\"thumb_media_id\":\"IscUQ9wYWha7tecu3dXpiG6tI5J_GYVPe0k_-ZMZvEU\",\"thumb_url\":\"http://mmbiz.qpic.cn/mmbiz_jpg/YeXepVfg851mGPARO3NOVXpIic3xev14AVkgwwtc8EKbpy2U1FY5CyTFYOX39EDuDEbfG2v9ib7Etc3kxVdgFcyg/0?wx_fmt=jpeg\",\"title\":\"动漫游学\",\"url\":\"http://mp.weixin.qq.com/s?__biz=MzA4ODkxODQ0OQ==&mid=100000029&idx=1&sn=fde455bab73f77388348cb9df5dcfb2c&chksm=102391c3275418d5abe2301ecc9d8c8a2af76c7c44d7ab37fabc7b051abc450225d93a94c800#rd\"}],\"update_time\":1505446725},\"media_id\":\"IscUQ9wYWha7tecu3dXpiMoAeIabmYToYTIBvjJw0Jg\",\"update_time\":1505446725},{\"content\":{\"create_time\":1505446692,\"news_item\":[{\"author\":\"\",\"content\":\"<p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">丝绸之路挑战赛</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><br  /></p><p style=\\\"white-space: normal;\\\"><img data-s=\\\"300,640\\\" data-type=\\\"jpeg\\\" data-src=\\\"http://mmbiz.qpic.cn/mmbiz_jpg/0ha58BRPxbaDtRricLzPo13MDMLo2vzFmtFP0YGSs2ajojoYDgRONBrtKuCoqE2sQ95A3xsTgZO9Ficd610KFqvw/0?wx_fmt=jpeg\\\" data-ratio=\\\"0.6377777777777778\\\" data-w=\\\"900\\\"  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><br  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">敦煌 ? 组委会</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">4月29日</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><a href=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=8f591bb199754bf9b30d5be3300fc911\\\" target=\\\"_blank\\\" data_ue_src=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=8f591bb199754bf9b30d5be3300fc911\\\"><span style=\\\"font-size: 18px;\\\">?立即报名?</span></a></p><p><br  /></p>\",\"content_source_url\":\"\",\"digest\":\"丝绸之路挑战赛敦煌 ? 组委会4月29日?立即报名?\",\"need_open_comment\":0,\"only_fans_can_comment\":0,\"show_cover_pic\":0,\"thumb_media_id\":\"IscUQ9wYWha7tecu3dXpiBkT0ukTEBo-BU2qMkJ2228\",\"thumb_url\":\"http://mmbiz.qpic.cn/mmbiz_jpg/YeXepVfg851mGPARO3NOVXpIic3xev14AOor0puuyHrrnoRYAK8IhOr1CJ0uwvG4vvMu6YViaEnavFDAica4RS9ibw/0?wx_fmt=jpeg\",\"title\":\"丝绸之路挑战赛\",\"url\":\"http://mp.weixin.qq.com/s?__biz=MzA4ODkxODQ0OQ==&mid=100000027&idx=1&sn=40c20c4dfaf524b7f558d1efd397a7cb&chksm=102391c5275418d3479d5d5308b5744d51753f3c194eeb8a6b8aa47ef3b53d9b2529bb1a3c14#rd\"}],\"update_time\":1505446692},\"media_id\":\"IscUQ9wYWha7tecu3dXpiBGyDVoYZ9SCiGFlUbru6dY\",\"update_time\":1505446692},{\"content\":{\"create_time\":1505446661,\"news_item\":[{\"author\":\"\",\"content\":\"<p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">马拉松</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\"><br  /></span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\"></span></p><p style=\\\"white-space: normal;\\\"><img data-s=\\\"300,640\\\" data-type=\\\"jpeg\\\" data-src=\\\"http://mmbiz.qpic.cn/mmbiz_jpg/0ha58BRPxbaDtRricLzPo13MDMLo2vzFmkj8ubMyIYibgdaGlx9KO0qjHJmatWyQiat0uZLzQAxJVZKfydtia2ELicg/0?wx_fmt=jpeg\\\" data-ratio=\\\"0.5875\\\" data-w=\\\"720\\\"  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\"></span><br  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">横店 ? 横店影视城</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">4月9日</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><a href=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=fa1939cee1ae47138209487bfa42aaa1\\\" target=\\\"_blank\\\" data_ue_src=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=fa1939cee1ae47138209487bfa42aaa1\\\"><span style=\\\"font-size: 18px;\\\">?立即报名?</span></a></p><p><br  /></p>\",\"content_source_url\":\"\",\"digest\":\"马拉松横店 ? 横店影视城4月9日?立即报名?\",\"need_open_comment\":0,\"only_fans_can_comment\":0,\"show_cover_pic\":0,\"thumb_media_id\":\"IscUQ9wYWha7tecu3dXpiOamCjqcPqU-Ae63I39Tzzg\",\"thumb_url\":\"http://mmbiz.qpic.cn/mmbiz_jpg/YeXepVfg851mGPARO3NOVXpIic3xev14AatrLibcUfbb4yTAiawUic9mR6gQZ9K4YbNjcdv0A1TzSuxmozIN4zMmyA/0?wx_fmt=jpeg\",\"title\":\"马拉松\",\"url\":\"http://mp.weixin.qq.com/s?__biz=MzA4ODkxODQ0OQ==&mid=100000025&idx=1&sn=47f21c64fbad526a8bebb9e9afd03b7d&chksm=102391c7275418d1d93448b88fc90f1a4958ac1b47ac85dede418f720ea35eb412c72d0e9343#rd\"}],\"update_time\":1505446661},\"media_id\":\"IscUQ9wYWha7tecu3dXpiEmkFE-VLqpm6Vf3_X2tX9o\",\"update_time\":1505446661},{\"content\":{\"create_time\":1505446639,\"news_item\":[{\"author\":\"\",\"content\":\"<p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">徒步</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\"><br  /></span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\"></span></p><p style=\\\"white-space: normal;\\\"><img data-s=\\\"300,640\\\" data-type=\\\"jpeg\\\" data-src=\\\"http://mmbiz.qpic.cn/mmbiz_jpg/0ha58BRPxbaDtRricLzPo13MDMLo2vzFmP5GPh8SbQEXicalzwGPN43txjHagABU9Fv9ugQ5uKeaf42JaheMcKgw/0?wx_fmt=jpeg\\\" data-ratio=\\\"0.6666666666666666\\\" data-w=\\\"600\\\"  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\"></span><br  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">嘉兴 ? 南北湖旅游</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">4月8日</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\"><a href=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=2430ff09fd5d402db7d85aa1c5b20f18\\\" target=\\\"_blank\\\" data_ue_src=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=2430ff09fd5d402db7d85aa1c5b20f18\\\">?立即报名?</a></span></p><p><br  /></p>\",\"content_source_url\":\"\",\"digest\":\"徒步嘉兴 ? 南北湖旅游4月8日?立即报名?\",\"need_open_comment\":0,\"only_fans_can_comment\":0,\"show_cover_pic\":0,\"thumb_media_id\":\"IscUQ9wYWha7tecu3dXpiMBopTR_0OTD95UeRhjfuXs\",\"thumb_url\":\"http://mmbiz.qpic.cn/mmbiz_jpg/YeXepVfg851mGPARO3NOVXpIic3xev14AibhOjbtZhsvVV9a6xLK97PNqNfibG6ycQ2AXliaQfRcyORpod6WZ5aUEQ/0?wx_fmt=jpeg\",\"title\":\"徒步\",\"url\":\"http://mp.weixin.qq.com/s?__biz=MzA4ODkxODQ0OQ==&mid=100000023&idx=1&sn=2432b9067046cfc838372fc83e1119fb&chksm=102391c9275418df16128d47ad861bd0092d396de42d0dafe5be1942c6fd71018356006f7ba9#rd\"}],\"update_time\":1505446639},\"media_id\":\"IscUQ9wYWha7tecu3dXpiH4uWIN7kgFfD8ayBrR8DpY\",\"update_time\":1505446639},{\"content\":{\"create_time\":1505446622,\"news_item\":[{\"author\":\"\",\"content\":\"<p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">滑冰</span></p><p style=\\\"white-space: normal;\\\"><br  /></p><p style=\\\"white-space: normal;\\\"><img data-s=\\\"300,640\\\" data-type=\\\"jpeg\\\" data-src=\\\"http://mmbiz.qpic.cn/mmbiz_jpg/0ha58BRPxbaDtRricLzPo13MDMLo2vzFmDvadZBUsHBeRlB1usuaryn6PUMVBFHBtqCicqAF4NWSHmzpIoTT3nSQ/0?wx_fmt=jpeg\\\" data-ratio=\\\"0.6105610561056105\\\" data-w=\\\"909\\\"  /></p><p style=\\\"white-space: normal;\\\"><br  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">齐齐哈尔 ? 组委会</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">3月04日</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><a href=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=961680cad1d548ae8c1482cf07c8a27c\\\" target=\\\"_blank\\\" data_ue_src=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=961680cad1d548ae8c1482cf07c8a27c\\\"><span style=\\\"font-size: 18px;\\\">?立即报名?</span></a></p><p><br  /></p>\",\"content_source_url\":\"\",\"digest\":\"滑冰齐齐哈尔 ? 组委会3月04日?立即报名?\",\"need_open_comment\":0,\"only_fans_can_comment\":0,\"show_cover_pic\":0,\"thumb_media_id\":\"IscUQ9wYWha7tecu3dXpiEy25RneWph9gZbs1OcW4XU\",\"thumb_url\":\"http://mmbiz.qpic.cn/mmbiz_jpg/YeXepVfg851mGPARO3NOVXpIic3xev14A5jzYQzgIOViad2Ik0N09U8gnicevYBRHNpb2QFBgTXFeYoWubZwevibTw/0?wx_fmt=jpeg\",\"title\":\"滑冰\",\"url\":\"http://mp.weixin.qq.com/s?__biz=MzA4ODkxODQ0OQ==&mid=100000021&idx=1&sn=bea87ecf457990b974df5de55c1cf311&chksm=102391cb275418dd8c10e7b6b8802e395ed5fdc11b61d2b2fea7e66d3a9dbe9cf649480202f1#rd\"}],\"update_time\":1505446623},\"media_id\":\"IscUQ9wYWha7tecu3dXpiGAgeuE_Ym5C5K0STAxFQfY\",\"update_time\":1505446623},{\"content\":{\"create_time\":1505446598,\"news_item\":[{\"author\":\"\",\"content\":\"<p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">登山</span><br  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 20px;\\\"><br  /></span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 20px;\\\"></span></p><p style=\\\"white-space: normal;text-align: center;\\\"><img data-s=\\\"300,640\\\" data-type=\\\"jpeg\\\" data-src=\\\"http://mmbiz.qpic.cn/mmbiz_jpg/0ha58BRPxbaDtRricLzPo13MDMLo2vzFmug0q2jEyHujP0gt7YqG9Xo57I0WnKY14dCPIG2TtTrAqZ4AOqNMJibw/0?wx_fmt=jpeg\\\" data-ratio=\\\"0.66625\\\" data-w=\\\"800\\\"  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 20px;\\\"></span><br  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">河源 ? 组委会</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">3月26日</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><a href=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=e1c648d7287940a8b3bdf30fcaf45787\\\" target=\\\"_blank\\\" data_ue_src=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=e1c648d7287940a8b3bdf30fcaf45787\\\"><span style=\\\"font-size: 18px;\\\">?立即报名?</span></a></p><p><br  /></p>\",\"content_source_url\":\"\",\"digest\":\"登山河源 ? 组委会3月26日?立即报名?\",\"need_open_comment\":0,\"only_fans_can_comment\":0,\"show_cover_pic\":0,\"thumb_media_id\":\"IscUQ9wYWha7tecu3dXpiGIsKdjIQX7_2hO_zOEjUoQ\",\"thumb_url\":\"http://mmbiz.qpic.cn/mmbiz_jpg/YeXepVfg851mGPARO3NOVXpIic3xev14AnWWhOwLpuMxUAKY7XfvX8UIsGBm2VP1aXLDsoNiaRbIWskicqFQzd9MA/0?wx_fmt=jpeg\",\"title\":\"登山\",\"url\":\"http://mp.weixin.qq.com/s?__biz=MzA4ODkxODQ0OQ==&mid=100000019&idx=1&sn=36f7c0f8c4e32557a0250a0cfa77ee86&chksm=102391cd275418db55daa8a3f6bdf770f9ba8157202a7b67d67a49e5bb46af2e325b0efd594e#rd\"}],\"update_time\":1505446598},\"media_id\":\"IscUQ9wYWha7tecu3dXpiCRYOHuhgWDKxzZHEvYiPlo\",\"update_time\":1505446598},{\"content\":{\"create_time\":1505446563,\"news_item\":[{\"author\":\"\",\"content\":\"<p style=\\\"white-space: normal;text-align: center;\\\"><br  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">高山滑雪</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 20px;\\\"><br  /></span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 20px;\\\"></span></p><p style=\\\"white-space: normal;\\\"><img data-s=\\\"300,640\\\" data-type=\\\"jpeg\\\" data-src=\\\"http://mmbiz.qpic.cn/mmbiz_jpg/0ha58BRPxbaDtRricLzPo13MDMLo2vzFm55cXS7HhicNEH7s8QjUYwQNCm49c5BOibVu0vTOuBZWUee3ibSnH3IWXg/0?wx_fmt=jpeg\\\" data-ratio=\\\"0.6662857142857143\\\" data-w=\\\"875\\\"  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 20px;\\\"></span><br  /></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">亚布力 ? 中国滑雪协会</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><span style=\\\"font-size: 18px;\\\">3月12日</span></p><p style=\\\"white-space: normal;text-align: center;\\\"><a href=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=eef65ada39e44ae2be7cc77fd558efef\\\" target=\\\"_blank\\\" data_ue_src=\\\"http://3g.tongxingzhe.cn/micWeb/html/hd/hd_detail.html?hdId=eef65ada39e44ae2be7cc77fd558efef\\\"><span style=\\\"font-size: 18px;\\\">?立即报名?</span></a></p><p><br  /></p>\",\"content_source_url\":\"\",\"digest\":\"高山滑雪亚布力 ? 中国滑雪协会3月12日?立即报名?\",\"need_open_comment\":0,\"only_fans_can_comment\":0,\"show_cover_pic\":0,\"thumb_media_id\":\"IscUQ9wYWha7tecu3dXpiK4cMFkV1jVAz6JGgyylhwo\",\"thumb_url\":\"http://mmbiz.qpic.cn/mmbiz_jpg/YeXepVfg851mGPARO3NOVXpIic3xev14AMsnRCmJmoTUfsPibGibNiaNb0pS3cicMqbicVaIMWIOBPpQGfZ0hv0h9BzQ/0?wx_fmt=jpeg\",\"title\":\"高山滑雪\",\"url\":\"http://mp.weixin.qq.com/s?__biz=MzA4ODkxODQ0OQ==&mid=100000017&idx=1&sn=750e0a3b406d9b62fc55f9768c3bebb3&chksm=102391cf275418d94d525522c60d5f4161af31559601f64f7bd0eaf215f033f9b6b8e369de44#rd\"}],\"update_time\":1505446563},\"media_id\":\"IscUQ9wYWha7tecu3dXpiBbzoUC_rHKMlI9x7aRFm1U\",\"update_time\":1505446563}],\"item_count\":9,\"total_count\":11}";
        String image = "{\"item\":[{\"media_id\":\"IscUQ9wYWha7tecu3dXpiCcFhwFjpjCa4rcH8k4QVog\",\"name\":\"file1ACkIABACGAAg5rCUzQUo1Ym04wcwhAc4owU.jpg\",\"update_time\":1503991912,\"url\":\"http://mmbiz.qpic.cn/mmbiz_jpg/YeXepVfg8538VrCPHwL4g79n5UjRpAzwl7swgk39CMp2VRnudBYFibweoOPw3cKuAy37bibotHaELUYINcYsHv1Q/0?wx_fmt=jpeg\"},{\"media_id\":\"IscUQ9wYWha7tecu3dXpiKO9LymUBBcSKbr3HDW7UO0\",\"name\":\"file1ACkIABACGAAgt62UzQUontKw4QMw3gg4ngU.jpg\",\"update_time\":1503991482,\"url\":\"http://mmbiz.qpic.cn/mmbiz_jpg/YeXepVfg8538VrCPHwL4g79n5UjRpAzwuib8OFZ2PElxqJRGjnVZ4Xqlw0JuoyKqbianicOKdHWZA2j0Qp549iaEyA/0?wx_fmt=jpeg\"},{\"media_id\":\"IscUQ9wYWha7tecu3dXpiO7Dr9TvBtoH4RKon5fBFZ8\",\"name\":\"file1ACkIABACGAAg9JSUzQUo-qHulwcwoAs4hAc.jpg\",\"update_time\":1503988342,\"url\":\"http://mmbiz.qpic.cn/mmbiz_jpg/YeXepVfg8538VrCPHwL4g79n5UjRpAzwsvMx0ibRfmOMNlRW4Gkop7IRViaOtNJfstN8uiaTWbBsKa7M8XYU1umog/0?wx_fmt=jpeg\"},{\"media_id\":\"IscUQ9wYWha7tecu3dXpiJqSc8sERoc0C-FcGAve9QM\",\"name\":\"InsertPic_(08-02-13-57-57).jpg\",\"update_time\":1470206367,\"url\":\"http://mmbiz.qpic.cn/mmbiz/YeXepVfg853FpibOk9NatQsddQH1KozUia9eougIJyXRjKMxHBbuhVUaQIQc6vXOibbztKfLFvnwJ4nqhwWYoWwiag/0?wx_fmt=jpeg\"}],\"item_count\":4,\"total_count\":4}";
        ajaxResult.setSuccess(true);
        if("image".equals(type)){
            ajaxResult.setData(JSONObject.parse(image));
        }else {
            ajaxResult.setData(JSONObject.parse(news));
        }
        return ajaxResult;
    }

   //跳转图文素材管理页（查）
//    @RequestMapping("view")
//    public ModelAndView materialView(){
//        ModelAndView mv = new ModelAndView("wechat/materialNews");
//        //
//        return mv;
//    }

    //跳转图片素材管理页
//    @RequestMapping("viewimage")
//    public ModelAndView materialViewImage(){
//        ModelAndView mv = new ModelAndView("wechat/materialImage");
//        //
//        return mv;
//    }

    //跳转 新建/编辑 永久图文素材编辑页
//    @RequestMapping("newsform")
//    public ModelAndView newsForm(){
//        ModelAndView mv = new ModelAndView("wechat/materialNewsForm");
//        return mv;
//    }

    //新增其它类型永久素材
//    @ResponseBody
//    @RequestMapping("addMaterial")
//    public AjaxResult addMaterial(){
//        AjaxResult ajaxResult = new AjaxResult();
//        MediaIdOutput wechatMedia = wechatMaterialBizService.addMaterial();
//        if(wechatMedia != null){
//            //TODO 操作数据库
//            ajaxResult.setSuccess(true);
//        }else{
//            ajaxResult.setSuccess(false);
//        }
//        return ajaxResult;
//    }

    //新增永久图文素材
//    @ResponseBody
//    @RequestMapping("addNews")
//    public AjaxResult addNews(NewsOutput input){
//        AjaxResult ajaxResult = new AjaxResult();
//        String mediaId = wechatMaterialBizService.addNews(input);
//        if(StringUtils.isEmpty(mediaId)){
//            ajaxResult.setSuccess(false);
//        }else{
//            //TODO 操作数据库
//            ajaxResult.setSuccess(true);
//        }
//        return  ajaxResult;
//    }

    //修改永久图文素材
//    @ResponseBody
//    @RequestMapping("updateNews")
//    public AjaxResult updateNews(NewsOutput output){
//        AjaxResult ajaxResult = new AjaxResult();
//        boolean openFlag = wechatMaterialBizService.updateNews(output);
//        if(!openFlag){
//            ajaxResult.setSuccess(false);
//        }else {
//            //TODO 操作数据库
////            wechatMaterialService.update(output);
//            ajaxResult.setSuccess(true);
//        }
//        return ajaxResult;
//    }

    //删除指定永久素材
//    @ResponseBody
//    @RequestMapping("delMaterial")
//    public AjaxResult delMaterial(String mediaId){
//        AjaxResult ajaxResult = new AjaxResult();
//        if(StringUtils.isEmpty(mediaId)){
//            ajaxResult.setSuccess(false);
//            return ajaxResult;
//        }
//        //调用删除接口
//        boolean opFlag = wechatMaterialBizService.deleteMaterial(mediaId);
//        if(!opFlag){
//            //微信端操作失败
//            ajaxResult.setSuccess(false);
//        }else{
////            wechatMaterialService.delete(mediaId);
//            ajaxResult.setSuccess(true);
//        }
//        return ajaxResult;
//    }

//    @ResponseBody
//    @RequestMapping("getNewsMaterial")
//    public AjaxResult getNewsMaterial(String mediaId){
//        AjaxResult ajaxResult = new AjaxResult();
//
//        NewsItemResponse resp = wechatMaterialBizService.getNewsMaterial(mediaId);
//        if(resp != null){
//            ajaxResult.setSuccess(true);
//            ajaxResult.setDescription("operation false");
//            ajaxResult.setData(resp);
//        }else{
//            ajaxResult.setSuccess(false);
//        }
//        return ajaxResult;
//    }
}